home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / utility / 95 / pascal / read_dat.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-01-15  |  1.1 KB  |  46 lines

  1.      PROGRAM read_data;
  2.  
  3.      { Read the data created in the program make_data }
  4.  
  5.        CONST
  6.          {$I gemconst.pas}
  7.  
  8.        TYPE
  9.          {$I gemtype.pas}
  10.  
  11.          rating = ( chief, cook, bottle_washer );
  12.  
  13.          info = record
  14.                   name : string [30];
  15.                   rank : rating;
  16.                 end; {info definition}
  17.  
  18.        VAR
  19.          myfile : file of INFO;
  20.          myrec  : info;
  21.  
  22.      {$I gemsubs.pas}
  23.  
  24.      BEGIN
  25.        IF Init_Gem >= 0 THEN
  26.          BEGIN
  27.            Reset( myfile, 'A:\INFO.DAT' );
  28.            WHILE NOT( EOF( myfile )) DO
  29.              BEGIN
  30.                myrec := myfile^;
  31.                WITH myrec DO
  32.                  BEGIN
  33.                    Writeln( name );
  34.                    CASE rank OF
  35.                      chief        : Writeln( 'chief' );
  36.                      cook         : Writeln( 'cook' );
  37.                      bottle_washer: Writeln( 'bottle washer' );
  38.                    END; {case}
  39.                  END; {with}
  40.                Get( myfile );
  41.              END; {while}
  42.            Close( myfile );
  43.          END; {if}
  44.        Exit_Gem;
  45.      END.
  46.